/** time.c: Kernel timer based syscall implementations
 *
 * Author: 	Nora Tarano <ntarano@andrew.cmu.edu>
 *          Yuan Meng <yuanm@andrew.cmu.edu>
 *          Yipeng Yun <yipengy@andrew.cmu.edu>
 * Date: 	Dec 11, 2011 
 */

#include <types.h>
#include <config.h>
#include <syscall.h>

#include <bits/errno.h>

#include <arm/timer.h>

unsigned long time_syscall(void)
{
  	return get_millis();
}

/** @brief Waits in a tight loop for atleast the given number of milliseconds.
 *
 * @param millis  The number of milliseconds to sleep.
 *
 * 
 */
void sleep_syscall(unsigned long millis)
{
  	unsigned long alarm = get_millis() + millis;
 	while (alarm != get_millis());
}
